package com.hongdee.base.carmodel.dao.impl;

import com.hongdee.base.basedao.impl.BaseDaoImpl;
import com.hongdee.base.carmodel.dao.ICarModelDao;
import com.hongdee.base.carmodel.entity.TBcCarModel;
import com.hongdee.base.carmodel.service.ICarModelService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 名  称:CarModelDaoImpl
 * 类  型:class
 * 描  述:
 * 路  径:com.hongdee.base.carmodel.dao.impl
 * 作  者: 术洪超
 * 日  期:2017-05-18 10:48
 */

@Service
public class CarModelDaoImpl extends BaseDaoImpl implements ICarModelDao {
    @Override
    public TBcCarModel info(String id) throws Exception {
        String hql="from TBcCarModel where id=:id";
        Map<String,Object> map=new HashMap<>();
        map.put("id",id);
        return (TBcCarModel) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
    }

    @Override
    public TBcCarModel infoByCode(String code) throws Exception {
        String hql="from TBcCarModel where modelCode=:code limit 1";
        Map<String,Object> map=new HashMap<>();
        map.put("code",code);
        return (TBcCarModel) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
    }
}
